package com.example.app.data.enum

import com.example.app.R

enum class AccountEditState(
    var label: String,
    var value: Any,
    var key: String
) {
    //类别管理
    ADD_CATEGORY(
        "新增类别",
        "ADD_CATEGORY",
        "ADD_CATEGORY"
    ),
    //类别管理
    EDIT_TITLE(
        "编辑标题",
        "EDIT_TITLE",
        "EDIT_TITLE"
    ),
    ;

    companion object {
        fun getVarByLabel(label: String): AccountEditState? {
            values().forEach {
                if (label == it.label) return it
            }
            return null
        }

        fun getVarByValue(value: Any): AccountEditState? {
            values().forEach {
                if (value == it.value) return it
            }
            return null
        }

        fun getVarByKey(key: String): AccountEditState? {
            values().forEach {
                if (it.key == key) return it
            }
            return null
        }
    }
}